package ltd.ninefish.framework.systemapi.service;

import ltd.ninefish.framework.core.constant.ServiceNameConst;
import ltd.ninefish.framework.core.result.Result;
import ltd.ninefish.framework.systemapi.dto.SysFileDto;
import ltd.ninefish.framework.systemapi.factory.RemoteFileFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author zhaoxiubin
 * create-time 2024-01-16 8:08
 * description 文件服务
 **/
@FeignClient(contextId = "remoteFileService", value = ServiceNameConst.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
public interface RemoteFileService {
    /**
     * 上传文件
     *
     * @param file 文件信息
     * @return 结果
     */
    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public Result<SysFileDto> upload(@RequestPart(value = "file") MultipartFile file);
}
